package com.jwsoft.manager.core.dao.model;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.StringJoiner;

/**
 * 地址树与学校关联表
 *
 * @author fangs
 * @since 2023-02-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("edu_address_tree_school")
@Schema(name = "EduAddressTreeSchool", title = "地址树与学校关联表", description = "地址树与学校关联表实体类")
public class EduAddressTreeSchool extends Model<EduAddressTreeSchool> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(name = "treeId", title = "edu_address_tree关联主键-address_id")
    @TableField(value = "tree_id")
    private Long treeId;

    @Schema(name = "schoolId", title = "edu_school关联主键-org_id")
    @TableField(value = "school_id")
    private String schoolId;

    @Schema(name = "schoolNature", title = "学校性质0.公办 1.民办")
    @TableField(value = "school_nature")
    private String schoolNature;

    @Schema(name = "schoolCategory", title = "学校类别")
    @TableField(value = "school_category")
    private String schoolCategory;

    @Schema(name = "schoolNum", title = "学校代码")
    @TableField(value = "school_num")
    private String schoolNum;

    @Schema(name = "schoolName", title = "学校名称")
    @TableField(value = "school_name")
    private String schoolName;

    @Schema(name = "shortName", title = "简称")
    @TableField(value = "short_name")
    private String shortName;

    @Schema(name = "areaCode", title = "行政区划")
    @TableField(value = "area_code")
    private String areaCode;

    @TableField(value = "del", fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL)
    @TableLogic
    private String del;

    @TableField(value = "del_uk", updateStrategy = FieldStrategy.NOT_NULL)
    private Long delUk;

    @Schema(name = "boundNextNum", title = "下级节点绑定该学区的数量")
    @TableField(value = "bound_next_num")
    private Integer boundNextNum;

    @Schema(name = "boundLeafNum", title = "叶子节点绑定该学区的数量")
    @TableField(value = "bound_leaf_num")
    private Integer boundLeafNum;

    @Schema(name = "serviceAreaFlag", description = "是否服务区 0 否 1是")
    @TableField(value = "service_area_flag")
    private String serviceAreaFlag;

    @Schema(name = "nativeFlag", title = "是否原住居民可读")
    @TableField(value = "native_flag")
    private String nativeFlag;

    @Override
    public Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", EduAddressTreeSchool.class.getSimpleName() + "[", "]")
                .add("id=" + id)
                .add("treeId=" + treeId)
                .add("schoolId='" + schoolId + "'")
                .add("schoolNature='" + schoolNature + "'")
                .add("schoolCategory='" + schoolCategory + "'")
                .add("schoolNum='" + schoolNum + "'")
                .add("schoolName='" + schoolName + "'")
                .add("shortName='" + shortName + "'")
                .add("areaCode='" + areaCode + "'")
                .add("del='" + del + "'")
                .add("delUk=" + delUk)
                .toString();
    }
}
